package com.hy.mydesktop.client.component.factory;

import java.util.List;

import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
import com.extjs.gxt.ui.client.widget.treegrid.TreeGridCellRenderer;
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response;

/**
 * 
 * <ul>
 * <li>开发作者：花宏宇</li>
 * <li>设计日期：2010-8-31；时间：上午11:17:43</li>
 * <li>类型名称：GridColumnConfigFactory</li>
 * <li>设计目的：此工厂，创建Grid的ColumnConfig列表</li>
 * </ul>
 * <ul>
 * <b>修订编号：</b>
 * <li>修订日期：</li>
 * <li>修订作者：</li>
 * <li>修订原因：</li>
 * <li>修订内容：</li>
 * </ul>
 */
public class GridColumnConfigFactory {
	
	private static List<ColumnConfig> configs;
	public static List<ColumnConfig> getConfigs() {
		return configs;
	}
	public static void setConfigs(List<ColumnConfig> configs) {
		GridColumnConfigFactory.configs = configs;
	}
	/**
	 * 
	 * <ul>
	 * <li>方法含义：创建Grid的<ColumnConfig>列表</li>
	 * <li>方法作者：花宏宇</li>
	 * <li>编写日期：2010-8-31；时间：下午上午11:16:46</li>
	 * </ul>
	 * <ul>
	 * <b>修订编号：</b>
	 * <li>修订日期：</li>
	 * <li>修订作者：</li>
	 * <li>修订原因：</li>
	 * <li>修订内容：</li>
	 * </ul>
	 * @param gxtComponentMetaNodeModel
	 * @return
	 */
	public static List<ColumnConfig> createColumnConfigList(int loaderNumber,GridCellRenderer<ModelData> ageRender,TreeGridCellRenderer<ModelData> treeRender){
		return configureColumnConfigList(loaderNumber,ageRender, treeRender);
	}
	/**
	 * 
	 * <ul>
	 * <li>方法含义：配置及装饰ColumnConfig列表</li>
	 * <li>方法作者：花宏宇</li>
	 * <li>编写日期：2010-8-31；时间：下午上午11:16:00</li>
	 * </ul>
	 * <ul>
	 * <b>修订编号：</b>
	 * <li>修订日期：</li>
	 * <li>修订作者：</li>
	 * <li>修订原因：</li>
	 * <li>修订内容：</li>
	 * </ul>
	 * @param gxtComponentMetaNodeModel
	 * @return
	 * @throws RequestException 
	 */
	private static List<ColumnConfig> configureColumnConfigList(
			int loaderNumber,GridCellRenderer<ModelData> ageRender,TreeGridCellRenderer<ModelData> treeRender) {
		
		RequestBuilder request = new RequestBuilder(RequestBuilder.POST,"add");
		try {
			request.sendRequest("true", new RequestCallback() {
				
				@Override
				public void onResponseReceived(Request request, Response response) {
					if(response.getStatusCode()==200){
						System.out.print("sdasddddddddddddddddddddd");
					}
				}
				
				@Override
				public void onError(Request request, Throwable exception) {
				}
			});
		} catch (RequestException e) {
			e.printStackTrace();
		}
		return configs;
	}
}
